package com.project.entity;


import java.util.HashMap;
import java.util.Map;


public class Result{
    private Integer code;

    private String msg;

    private Map<String,Object> data =  new HashMap<>();



    public void putData(String key, Object value) {
        data.put(key, value);
    }

    public Result error(String msg){
        this.code = 500;
        this.msg = msg;
        return this;
    }

    public Result success(String msg){
        this.code = 200;
        this.msg = msg;
        return this;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }
}
